package com.example.day1203;

/**
 * @author Lenovo
 */
public class Jumpping {
    interface jumpping {
        void jump();
    }
    class Cat implements jumpping {
        @Override
        public void jump() {
            System.out.println("猫跳");
        }
    }
    class Dog implements jumpping {
        @Override
        public void jump() {
            System.out.println("狗跳");
        }
    }
    class JumppingOperator{
        public void useJumpping(jumpping jumpping){
            jumpping.jump();
        }

        public void method(jumpping j) {
        }
    }
    class JumppingDemo{
        public void main(String[] args) {
            JumppingOperator jo = new JumppingOperator();
            jumpping j = new Cat();
            jo.method(j);

            jumpping j2 = new Dog();
            jo.method(j2);
            System.out.println("-------");
            jo.method(new jumpping() {
                @Override
                public void jump() {

                }
            }); {
                public void jump() {
                    System.out.println("匿名内部类");
                }
            };
            jo.method(new jumpping() {
                @Override
                public void jump() {
                    System.out.println("匿名内部类");
                }
            });
        }
    }
}
